Hello, |
Re: Monitor the update of objects with a trigger If I had this chore, I'd write an on-demand script scheduled to run every night, which generates a single email and looks through all the modules of a Project looking for reportable changes in History. If scheduled for "12:01am" 00:00:01 you could look for History from 'yesterday'. Folks will appreciate a single email, and will tend to ignore the scores of individual emails they will get with the Trigger approach. Also, the Trigger approach falls down when folks make a change, trigger an email, then do not save the module. It is also weak in that the local user will end up sending the email, which can cause confusion and hassle. Anway, as for the Trigger: its probably better to have the trigger deployed in the Project with smarts to know which modules to ignore. If you change the Trigger you change it on one place. Deploying it in each 'important' module makes the Trigger itself a little simpler, but its a bit of a nightmare when you want to make changes to the Trigger.
|
Re: Monitor the update of objects with a trigger llandale - Sun Mar 28 18:50:30 EDT 2010
Thank you for your answer. Posting my problem here, I've thought that it can be used a trigger with a specific entity, which action at level attribute, event save. I mean that the users update the values of objects, and when they save the module, at this time the trigger fire and send mails to the users. The trigger is defined like: trigger("trig_name", attribute->all, post , save, 1,"#include <triggers/test_trig.dxl>") There is someone who used this kind of trigger at *attribute level*? Can you help me with some examples? Many thanks and looking for your answer, Silvius |
Re: Monitor the update of objects with a trigger llandale - Sun Mar 28 18:50:30 EDT 2010
a) We only have two people devoted to writing DXL, but a lot of software people otherwise. So all I have to do is write dump code and someone else can write the processing code. b) Processing vast amounts of data goes much quicker in something like python or perl. c) With the results in an SQL database, there are tons of code projects out there to convert the database to web pages. |
Re: Monitor the update of objects with a trigger SystemAdmin - Mon Mar 29 10:07:58 EDT 2010 Like most other people on this forum, I'd love to have that luxury! This is a part time job for me; my "real" job is managing a test team :-( |
Re: Monitor the update of objects with a trigger Silvius - Mon Mar 29 10:02:30 EDT 2010 Above that we see that a 'save' event trigger means 'write' or 'modify', it does not mean 'save the module'. So you can have a post-attribute-save trigger, which fires after the value has been changed; or a pre-module-close trigger, which figures to examine History of the current session and generate an email for all the important changes just made. You almost certainly do NOT want to use that $include statement, since the person running DOORS may no have access to your file. Instead you should use readfile() and also checkDXL().
|
Re: Monitor the update of objects with a trigger llandale - Sun Mar 28 18:50:30 EDT 2010
I am very interested by the approach you describe : I would like to send an nightly email notification if a specific module has been modified. How do you "look for History from 'yesterday'", as you mentionned ? Any piece of code you would be able to share ? Best regards, Servanne. |
Re: Monitor the update of objects with a trigger sdauphin - Thu Jul 15 11:34:51 EDT 2010
You would use the Windows 'scheduled task' feature that invokes a *.bat (text) file that contains the invokation of DOORS. I put mine in a folder and deny the rest of the entire world read rights, in order to protect the unencrypted passwords in the bat file. You write a 'batch' *.dxl script invoked via the '-b' DOORS command line switch.
const int SecsInDay = 60*60*24
bool WasThisYesterday(Date in_dat)
{ int iNow = intOf(today())
int iThen = infOf(in_dat)
return(iThen + SecsInDay > iNow)
} // end WasThisYesterday(Date)
bool WasChangedYesterday(Object obj)
{ // Was the Object changed yesterday?
History hst
Date datHist
string NameAttr
for hst in obj do
{ datHist = hst.date
if (!WasThisYesterday(datHist)) continue
// Changed yesterday. Is it a 'serious' change?
noError()
NameAttr = ""
NameAttr = hst.attrName
lastError
if (NameAttr == "Object Text") return(true) // Serious/recent change
}
return(false)
} // end WasChangedYesterday(Object)
const string gl_OleOutlookApp = "Outlook.Application" // Windows recognizes this as a running Outlook
//******************************
bool fEmailCreateOutlookMail(bool DoSend, string SendTo, SendCC, SendBCC, Subject, Body)
{ // Create the Email message which requires that Outlook.exe is running.
// SendTo, SendCC, and SendBCC should be valid Email addresses separated by semi-colons;.
// Send the Message when DoSend, otherwise just display it.
bool Result = false
OleAutoObj oaoMessage = null
OleAutoObj oaoOutlook = oleGetAutoObject(gl_OleOutlookApp)
if (null oaoOutlook)
{ fOleOK("Outlook not running", "GetOutlook") // Log Error
return(false)
}
OleAutoArgs autoArgs = create()
clear(autoArgs)
put(autoArgs, 0) // 0 is Outlook's symbolic constant for mail item
if(fOleOK(oleMethod(oaoOutlook, "CreateItem", autoArgs, oaoMessage), "CreateItem") and
fOleOK(olePut(oaoMessage, "To", SendTo), "To") and
fOleOK(olePut(oaoMessage, "CC", SendCC), "CC") and
fOleOK(olePut(oaoMessage, "BCC", SendBCC), "BCC") and
fOleOK(olePut(oaoMessage, "Subject", Subject), "Subject") and
fOleOK(olePut(oaoMessage, "Body", Body), "Body")
)
{ // Message created OK. Send or just Show it
if (DoSend)
Result = fOleOK(oleMethod(oaoMessage, "Send"), "Send")
else Result = fOleOK(oleMethod(oaoMessage, "Display"), "Display")
}
else Result = false
delete(autoArgs)
return(Result)
} // end fEmailCreateOutlookMail()
|
Re: Monitor the update of objects with a trigger llandale - Thu Jul 15 18:33:33 EDT 2010
You would use the Windows 'scheduled task' feature that invokes a *.bat (text) file that contains the invokation of DOORS. I put mine in a folder and deny the rest of the entire world read rights, in order to protect the unencrypted passwords in the bat file. You write a 'batch' *.dxl script invoked via the '-b' DOORS command line switch.
const int SecsInDay = 60*60*24
bool WasThisYesterday(Date in_dat)
{ int iNow = intOf(today())
int iThen = infOf(in_dat)
return(iThen + SecsInDay > iNow)
} // end WasThisYesterday(Date)
bool WasChangedYesterday(Object obj)
{ // Was the Object changed yesterday?
History hst
Date datHist
string NameAttr
for hst in obj do
{ datHist = hst.date
if (!WasThisYesterday(datHist)) continue
// Changed yesterday. Is it a 'serious' change?
noError()
NameAttr = ""
NameAttr = hst.attrName
lastError
if (NameAttr == "Object Text") return(true) // Serious/recent change
}
return(false)
} // end WasChangedYesterday(Object)
const string gl_OleOutlookApp = "Outlook.Application" // Windows recognizes this as a running Outlook
//******************************
bool fEmailCreateOutlookMail(bool DoSend, string SendTo, SendCC, SendBCC, Subject, Body)
{ // Create the Email message which requires that Outlook.exe is running.
// SendTo, SendCC, and SendBCC should be valid Email addresses separated by semi-colons;.
// Send the Message when DoSend, otherwise just display it.
bool Result = false
OleAutoObj oaoMessage = null
OleAutoObj oaoOutlook = oleGetAutoObject(gl_OleOutlookApp)
if (null oaoOutlook)
{ fOleOK("Outlook not running", "GetOutlook") // Log Error
return(false)
}
OleAutoArgs autoArgs = create()
clear(autoArgs)
put(autoArgs, 0) // 0 is Outlook's symbolic constant for mail item
if(fOleOK(oleMethod(oaoOutlook, "CreateItem", autoArgs, oaoMessage), "CreateItem") and
fOleOK(olePut(oaoMessage, "To", SendTo), "To") and
fOleOK(olePut(oaoMessage, "CC", SendCC), "CC") and
fOleOK(olePut(oaoMessage, "BCC", SendBCC), "BCC") and
fOleOK(olePut(oaoMessage, "Subject", Subject), "Subject") and
fOleOK(olePut(oaoMessage, "Body", Body), "Body")
)
{ // Message created OK. Send or just Show it
if (DoSend)
Result = fOleOK(oleMethod(oaoMessage, "Send"), "Send")
else Result = fOleOK(oleMethod(oaoMessage, "Display"), "Display")
}
else Result = false
delete(autoArgs)
return(Result)
} // end fEmailCreateOutlookMail()
Thanks to your code snippets, I implemented a quick solution. I just check the last modified date of the modules, and send an email to a (hard coded) list of people. From what you are describing, I need to think more about how I am going to manage users and email lists in the long run ... Frankly speaking, I am a little surprized that we need to code everything to deploy email notifications. From a long-standing tool like DOORS, I would expect something more user-friendly. Best regards, Servanne. |
Re: Monitor the update of objects with a trigger sdauphin - Mon Jul 19 08:47:33 EDT 2010 |